/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Vinicio Gomez
 */
@Entity
@Table(name = "carpool")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Carpool.findAll", query = "SELECT c FROM Carpool c"),
    @NamedQuery(name = "Carpool.findByZona", query = "SELECT c FROM Carpool c WHERE c.zona = :zona"),
    @NamedQuery(name = "Carpool.findByDia", query = "SELECT c FROM Carpool c WHERE c.dia = :dia"),
    @NamedQuery(name = "Carpool.findByHorario", query = "SELECT c FROM Carpool c WHERE c.horario = :horario"),
    @NamedQuery(name = "Carpool.findByCosto", query = "SELECT c FROM Carpool c WHERE c.costo = :costo"),
    @NamedQuery(name = "Carpool.findByEmail", query = "SELECT c FROM Carpool c WHERE c.email = :email"),
    @NamedQuery(name = "Carpool.findByMaximo", query = "SELECT c FROM Carpool c WHERE c.maximo = :maximo")})
public class Carpool implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "zona")
    private Short zona;
    @Lob
    @Column(name = "interes")
    private byte[] interes;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "dia")
    private String dia;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "horario")
    private String horario;
    @Basic(optional = false)
    @NotNull
    @Column(name = "costo")
    private short costo;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "email")
    private String email;
    @Basic(optional = false)
    @NotNull
    @Column(name = "maximo")
    private short maximo;

    public Carpool() {
    }

    public Carpool(Short zona) {
        this.zona = zona;
    }

    public Carpool(Short zona, String dia, String horario, short costo, String email, short maximo) {
        this.zona = zona;
        this.dia = dia;
        this.horario = horario;
        this.costo = costo;
        this.email = email;
        this.maximo = maximo;
    }

    public Short getZona() {
        return zona;
    }

    public void setZona(Short zona) {
        this.zona = zona;
    }

    public byte[] getInteres() {
        return interes;
    }

    public void setInteres(byte[] interes) {
        this.interes = interes;
    }

    public String getDia() {
        return dia;
    }

    public void setDia(String dia) {
        this.dia = dia;
    }

    public String getHorario() {
        return horario;
    }

    public void setHorario(String horario) {
        this.horario = horario;
    }

    public short getCosto() {
        return costo;
    }

    public void setCosto(short costo) {
        this.costo = costo;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public short getMaximo() {
        return maximo;
    }

    public void setMaximo(short maximo) {
        this.maximo = maximo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (zona != null ? zona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Carpool)) {
            return false;
        }
        Carpool other = (Carpool) object;
        if ((this.zona == null && other.zona != null) || (this.zona != null && !this.zona.equals(other.zona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.Carpool[ zona=" + zona + " ]";
    }
    
}
